home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7247 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  7.0 KB

  1. Path: news.NetVision.net.il!news
  2. From: Jack <avilev@netvision.net.il>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: 680X0 -> PPC translator?
  5. Date: Fri, 12 Apr 1996 17:53:36 -0700
  6. Organization: NetVision LTD.
  7. Message-ID: <316EFB10.6EBD@netvision.net.il>
  8. References: <31499F8E.26A9@netvision.net.il> <volker.0fw1@vb.franken.de><315800D7.1854@sapiens.com>
  9.         <volker.0g32@vb.franken.de><315C198B.49C2@netvision.net.il>
  10.         <volker.0g5w@vb.franken.de><1996Apr2.230841.8275@scala.scala.com>
  11.         <31640B0C.23F5@netvision.net.il> <1586.6669T961T2657@und.ida.liu.se> <31695324.57C8@netvision.net.il> <4770.6673T831T125@und.ida.liu.se>
  12. NNTP-Posting-Host: ts004p6.pop4a.netvision.net.il
  13. Mime-Version: 1.0
  14. Content-Type: text/plain; charset=us-ascii
  15. Content-Transfer-Encoding: 7bit
  16. X-Mailer: Mozilla 2.01 (Win16; I)
  17.  
  18. Mans Engman wrote:
  19. > >Mans Engman wrote:
  20. > >>
  21. > >> Once you think a bit, it's easy to show (prove!) that static code<->data
  22. > >> distinction can't be determined by an algorithm. It is what theorists call
  23. > >> an "undecidable" problem. Granted, for a "real" computer with a finite
  24. > >> amount of memory/indata it can be "solved" by brute-force search, but this
  25. > >> is not a practical approach.
  26. > >many problems aren't solvable with today's technology, but it doesn't mean
  27. > >they're not solvable with other yet-to-devised methods, now do they??
  28. > What do you mean? You think someone will come up with algorithms to solve
  29. > problems *beyond* what a Turing machine can?
  30. > excuse my poor knowledge of the english language, but i don't know what the hell turing
  31. machines are, so i can't reply to that.
  32.  
  33. > >>
  34. > >> Okay, let's go on:
  35. > >>
  36. > >> 1) Hilberts 10th problem is a well known, proven undecidable problem. The
  37. > >> problem is determining whether an integer polynomial equation has a
  38. > >> (integer) solution.
  39. > >oh please, stick to the subject at hand and stop making irrelevant analogies.
  40. > This isn't an "irrelevant analogy", it's a simple example (among *many*
  41. > undecidable problems) used to construct a program for which you can't analyse
  42. > the program flow statically.
  43.  
  44. 'among many', PRECISLEY my point, your point still doesn't make it clear why static
  45. code translation isn't possible, don't generalise on questionable theories and be mucho more
  46. concrete, PLEASE!!!!
  47.  
  48. > >> 2) Now imagine a program calculating some function on the indata x, y, ...
  49. > >> and uses the result as a pc-relative address where we jump. This function,
  50. > >> and the rest of the program can be constructed such that for all x, y, ...
  51. > >> we jump to a legal piece of code. Between these code chunks we will of
  52. > >> course put data to confuse anyone analysing the program! :)
  53. > >you havn't really thought about the implementation of your hypothetic
  54. > >scenario have you?! in order for what you said to work you must store the
  55. > >offsets from the current locations in some array, and the inputs are used to
  56. > >calculate the array entry that should be selected that's all.
  57. > No, I didn't intend using an array.
  58. > I can easily construct a function that will be within certain bounds,
  59. > and will always be a multiple of, say, 42, and you'll not be able to
  60. > know/prove that by using an algorithm. That's the whole point of the example;
  61. > the function itself is very easy to calculate, but it is undecidable what the
  62. > possible results will be.
  63.  
  64. No,no,no that's not what you said, you refered to making a pc-relative jump using some
  65. calculated value returned by some mathemtic function which is simply not possible
  66. cus then you'd have to call the function from distances of integer multiples of 
  67. your defined interval (say 42) otherwise you can't call the function from any other place that way and
  68. that's simply not practical to use in any program, AH AH no sirry.
  69. and even if you use this method there's no problem detecting the function which calculates
  70. this offset and figure which intervals are being used in the calculation. after all the interval
  71. is fixed and the interface of fata exchange between the caller and the callee is known
  72. to the analysing program, so it could discern the pattern and actually jump in integer multiples
  73. of that interval to either of the 2 directions (up,down) and find the called functions that way.
  74.  
  75.  
  76. > Even if you use an array, you'd have exactly the same problem trying to know
  77. > which elements of the array are used as code pointers, and which of them are
  78. > something completely different. Like pointers to data which looks like
  79. > code, but isn't used as such (see below).
  80. > not if the pointed code bytes make some sense ie use defined data addresses, make valid calls,
  81. has an RTS at the end, no, it's just too ordered for it to be just random chaos, now would it.
  82.  
  83. > >calculating the
  84. > >correct number of bytes to skip from arbitrary inputs without using this
  85. > >method is next to impossible and most practical applications don't use this
  86. > >method.
  87. > It's perhaps not practical to have this very-advanced-function(tm) to
  88. > calculate jump-addresses, but it's legal and possible.
  89.  
  90. your 'highly' advanced feature will just have to wait for version 2.0 of the translator,
  91. i guess, initial target is for 'less-advanced' programs if you wish to call it that way
  92. which consist of ALL existing programs.
  93.  
  94.  
  95. > >you can't confuse the analysing program because ALL code sequences
  96. > >can be identified without a problem, every sequence of words that makes sense
  97. > >as a code sequence must be executable code and therefore can be identified.
  98. > >by 'makes sense' i mean that the code makes references to other parts of the
  99. > >program and a sequence of code instructions is  maintained, you simply have
  100. > >to follow the logic of that section and see if it's interrupted by some data
  101. > >word without a jump that would prevent such a thing from happening.
  102. > What you or your analyser thinks "makes sense" as executable code is not
  103. > neccessarily code that will be executed.
  104. > For instance, if some
  105. > section of my program is
  106. > $7070
  107. > $c1c1
  108. > $4e75
  109. > and I some of the words as data (nice bit masks), you have
  110. > no right to interpret the sequence as
  111. > moveq   #112,d0
  112. > muls    d1,d0
  113. > rts
  114. > even though that would "make sense" as legal code.
  115. >yes, true, but you can defer the translation until you ,ake sure someone's calling
  116. this piece of code, which can be done by further analysing the rest of the program.
  117. and besides, if a sequence of words makes some sense ie makes valid references to other
  118. memory areas and it's a long section then it's probably code, even you would have to agree
  119. that this is highly unlikely that it's some other data.
  120.  
  121. > The best thing you can do about this is to have the both the original data
  122. > and the translated part, in the final translated program.
  123. > Then, you could determine, at *run-time*, how it is used.
  124.  
  125.  
  126. NO!! no way, all the required information is in the binary itself, no need for any run-time
  127. analysis, you just need to know how to correctly distill this information into a useful one
  128. which i have described how in previous articles. give me problems i can't solve and then
  129. i'll raise my white flag otherwise, it's on with the crusade and the pirate skull flag
  130. is still held up high. hehehe
  131.  
  132.  
  133. Avi Lev.
  134.